﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using MetaNote.Model;

namespace MetaNote
{
    static class Convert
    {
        internal static Font ToFont(SerializableFont value) {
            return new Font(value.FontFamily, value.FontSize, value.Style, value.GraphicsUnit, value.gdiCharSet);
        }

        internal static SerializableFont ToSerializableFont(Font font)
        {
            var sfont = new SerializableFont();
            if (font != null)
            {
                sfont.FontFamily = font.FontFamily.Name;
                sfont.FontSize = font.SizeInPoints;
                sfont.Style = font.Style;
                sfont.GraphicsUnit = GraphicsUnit.Point;
                sfont.gdiCharSet = font.GdiCharSet;
            }
            return sfont;
        }
    }
}
